package in.ac.dei.edrp.cms.utility;

import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer; 

class StringToke{
	
	public static void main(String[] s){
		System.out.println(getFianl("03/01"));

}//main ends
public static String getFianl(String inputDate){
	String finalDate="";
	Calendar cal = Calendar.getInstance();
	
	int month = cal.get(Calendar.MONTH)+1;
	int year = cal.get(Calendar.YEAR);
	System.out.println("year: "+year+" and moth"+month);
	StringTokenizer st = new StringTokenizer(inputDate,"/-");
	Map<Integer,Integer> monthMap=new HashMap<Integer,Integer>();
	int key=0;
    while (st.hasMoreElements()) {
        int token = Integer.parseInt(st.nextToken());
        //System.out.println("token = " + token);
        monthMap.put(key, token);
        key++;
    }//loop ends
    int monthCompare=0;
    int date=0;
    for (Map.Entry<Integer, Integer> map : monthMap.entrySet()){
    	if(map.getKey()==0){
    	monthCompare=map.getValue();
    	System.out.println(monthCompare);
        	if(monthCompare<month){
        		year=year+1;
        	}
    	}
    	if(map.getKey()==1){
    		date=map.getValue();
    	}
    	
    }
    finalDate=year+"-"+monthCompare+"-"+date;
    return finalDate;
}
}
